home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 4 / The Arsenal Files 4 (Arsenal Computer).ISO / casm / au116-as.exe / UTIL / ALLOC.CPP < prev    next >
C/C++ Source or Header  |  1994-03-12  |  775b  |  39 lines

  1. #include "..\au.hpp"
  2.  
  3. /**************************************************************************/
  4. void *au_calloc(AU *au, int size, int number)
  5. {
  6.     void *ptr;
  7.  
  8.     ptr = calloc(size, number);
  9.     if (ptr == NULL)
  10.     {
  11.         au_printf_error(au, "\nOut of Memory");
  12.         exit(1);
  13.     }
  14.     return ptr;
  15. }
  16. /**************************************************************************/
  17. void *au_malloc(AU *au, int size)
  18. {
  19.     void *ptr;
  20.  
  21.     ptr = malloc(size);
  22.     if (ptr == NULL)
  23.     {
  24.         au_printf_error(au, "\nOut of Memory");
  25.         exit(1);
  26.     }
  27.     return ptr;
  28. }
  29.  
  30. /*************************************************************************/
  31. char *string_save(AU *au, char *string)
  32. {
  33.     char *ptr;
  34.  
  35.     ptr = (char *)au_malloc(au, strlen(string)+1);
  36.     strcpy(ptr, string);
  37.     return ptr;
  38. }
  39.